

// console.log(typeof 'str');   //string
// console.log(typeof 2);    //number
// console.log(typeof true);   //boolean
// console.log(typeof undefined);    //undefined
// let a = Symbol("11")
// console.log(typeof a);    //symbol
// console.log(typeof 123n);   //bigint
// console.log(typeof null);   //object



// console.log(typeof {});   //object
// console.log(typeof []);   //object
// console.log(typeof new Date());   //object

// console.log(typeof function () { });  //function

// console.log([] instanceof Object);   //true
// console.log({} instanceof Object);    //true
// console.log(new Date() instanceof Object)   //true
// console.log(function () { } instanceof Object);    //true

// console.log('str' instanceof String);  //false

function myinstanceof(L, R) {
  while (L !== null) {
    L = L.__proto__
    if (L === R.prototype) {
      return true
    }
  }
  return false
}
console.log(myinstanceof([], Array));

console.log(myinstanceof([], Object)); // true